package com.qfedu.controller;

import com.qfedu.pojo.req.PlogerReq;
import com.qfedu.pojo.req.ThemeReq;
import com.qfedu.pojo.resp.BaseResp;
import com.qfedu.service.PlogerService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/ploger")
@Api(tags="博主信息")
public class PlogerController {
    @Autowired
    PlogerService plogerService;
    //显示所有用户
    @PostMapping("/findAllPloger")
    public BaseResp findAll(){
        return plogerService.findAll();
    }
    //查询一个博主的详细信息
    @PostMapping("/findByPlogerId")
    public BaseResp findByPlogerId(@RequestBody PlogerReq plogerReq){
        return plogerService.findByPlogerId(plogerReq.getPloger().getPlogerId());
    }
    //查询所有主题
    @PostMapping("/findAllTheme")
    public BaseResp findAllTheme(){
        return plogerService.findAllTheme();
    }
    //查询热门主题的评论
    @PostMapping("/findCommentByThemeId")
    public BaseResp findCommentByTheme(@RequestBody ThemeReq themeReq){
        return plogerService.findCommentByTheme(themeReq.getId());
    }
    //根据时间
    @PostMapping("/findCommentByThemeDESC")
    public BaseResp findCommentByThemeDESC(@RequestBody ThemeReq themeReq){
        return plogerService.findCommentByThemeDESC(themeReq.getId());
    }

    //获取具体某一条评论的详细信息
    @PostMapping("/findCommentByCommentId")
    public BaseResp findCommentByCommentId(@RequestBody PlogerReq plogerReq){
        return plogerService.findCommentByCommentId(plogerReq.getCommentId());
    }
}
